<script setup>
defineProps({
  tool: {
    type: Object,
    required: true
  }
})
</script>

<template>
  <div class="tool-card" :class="{ locked: !tool.unlocked }">
    <div class="tool-image">
      <img :src="tool.image" :alt="tool.name">
      <div class="tool-level">Lv.{{ tool.level }}</div>
      <div v-if="!tool.unlocked" class="lock-overlay">
        <span class="lock-icon">🔒</span>
      </div>
    </div>
    <div class="tool-info">
      <h3>{{ tool.name }}</h3>
      <p class="description">{{ tool.description }}</p>
      <div v-if="!tool.unlocked" class="required-exp">
        需要经验: {{ tool.requiredExp }}
      </div>
    </div>
  </div>
</template>

<style scoped>
.tool-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s;
  cursor: pointer;
}

.tool-card:hover {
  transform: translateY(-4px);
}

.tool-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.tool-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-level {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-icon {
  font-size: 32px;
}

.tool-info {
  padding: 16px;
}

.tool-info h3 {
  font-size: 18px;
  color: #4a4a4a;
  margin-bottom: 8px;
}

.description {
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.required-exp {
  color: #ef5350;
  font-size: 14px;
  padding: 4px 8px;
  background: #ffebee;
  border-radius: 4px;
  display: inline-block;
}

.locked {
  opacity: 0.8;
}
</style> 